﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using TheOutfield.UmbExt.PrivateMessaging.Model;

namespace TheOutfield.UmbExt.PrivateMessaging.Data
{
    public class MessageRepository
    {
        protected Connection conn;

        public MessageRepository()
        {
            conn = new Connection();
        }

        public Message CreateMessage(Message message)
        {
            using (var dc = conn.GetContext())
            {
                dc.Messages.InsertOnSubmit(message);
                dc.SubmitChanges();
            }

            return message;
        }
    }
}